package com.wanxi.service;

import com.wanxi.dao.BrandDao;
import com.wanxi.model.Brand;

import java.util.List;

public class BrandService {
    public int add(Brand brand) {
        if (brand.getSort() < 1) {
            brand.setSort(1);
        }
        if (brand.getSort() > 10000) {
            brand.setSort(999);
        }
       return new BrandDao().add(brand);
    }

    public List<Brand> findAll(Brand brand) {
        return new BrandDao().getList(brand);
    }

    public int delete(Brand brand) {
        return new BrandDao().delete(brand);
    }

    public Brand findById(Brand brand) {
        return new BrandDao().findById(brand);
    }

    public int update(Brand brand) {
        return new BrandDao().update(brand);
    }
}
